package com.liang.design;

import java.util.concurrent.atomic.AtomicReference;

/**
 * @author lsm
 * @ClassName Singleton_06.java
 * @Description CAS[AtomicReference](线程安全)
 * @createTime 2023年12月01日 10:37:00
 */
public class Singleton_06 {

    private static AtomicReference<Singleton_06> instance;

    private Singleton_06(){}

    public static Singleton_06 getInstance(){
        if (null == instance.get()){
            instance.compareAndSet(null,new Singleton_06());
        }
        return instance.get();
    }
}
